package myapps.ttclient.protocol.message.powerpoint;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import myapps.ttclient.Helper;
import myapps.ttclient.baseclass_and_interface.TTClientMessage;

public class PPTWindowsRelationshipResponseMessage extends TTClientMessage
{
	public String temporaryKey = "";

	public String[] presentationNames;
	
	public int activeWindowIndex = -1;

	public PPTWindowsRelationshipResponseMessage(String temporaryKey, String[] presentationNames, int activeWindowIndex)
	{
		this.temporaryKey = temporaryKey;
		this.presentationNames = presentationNames;
		this.activeWindowIndex = activeWindowIndex;
	}

	public static TTClientMessage parse(DataInputStream dis) throws IOException
	{
		String key =  Helper.ParseAsString(dis);
		
		String[] presentationNames = null;
		
		int n = dis.readInt();
		
		if(n != 0)
		{
			presentationNames = new String[n];
			
			for(int i = 0; i < n; i++)
			{
				presentationNames[i] = Helper.ParseAsString(dis);
			}
		}
			
		int activeWindowIndex = dis.readInt();

		return new PPTWindowsRelationshipResponseMessage(key, presentationNames, activeWindowIndex);
	}

	@Override
	public void toDataOutputStream(DataOutputStream dos) throws IOException
	{
		throw new IOException("NotImplemented");
	}
}